#include <cstdio>
#include <algorithm>
using namespace std;
long long n;
int main(void){
    scanf("%lld",&n);
    long long ans=0;
    ans+=(n/2+n/3+n/5+n/7);
    ans-=(n/6+n/10+n/14+n/15+n/21+n/35);
    ans+=(n/30+n/42+n/70+n/105);
    ans-=(n/210);
    printf("%lld\n",n-ans);
    return 0;
}